//
//  YQLoginViewController.m
//  MeiMeng
//
//  Created by weixb on 2017/3/21.
//  Copyright © 2017年 weixb. All rights reserved.
//

#import "YQLoginViewController.h"
#import "YQLoginPageView.h"
#import <YQTools.h>
//#define RGB(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]
@interface YQLoginViewController ()

@end

@implementation YQLoginViewController

- (instancetype)init
{
    self = [super init];
    if (self) {
        UIStoryboard *sb = [UIStoryboard storyboardWithName:@"YQLogin" bundle:nil];
        self = [sb instantiateViewControllerWithIdentifier:@"YQLoginNav"];
    }
    return self;
}
#pragma mark - life cycle
/* 1.viewDidAppear里面做Notification的监听之类的事情
 2.属性的初始化，则交给getter去做
 */
- (void)viewDidLoad {
    [super viewDidLoad];
    [self layoutPageSubviews];
    /* 设置导航栏标题属性 */
    NSDictionary * navTitleDic = @{NSForegroundColorAttributeName:RGB(209, 178, 124)};
    self.navigationController.navigationBar.titleTextAttributes = navTitleDic;
}
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:YES];
}
- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [self.view yq_whenLongPressed:^(UILongPressGestureRecognizer * _Nonnull longPressGesture) {
        [[YQLoginPageView manager] showPageView];
    }];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [self.view endEditing:YES];
}

/* add constraints */
- (void)layoutPageSubviews {
    
}
#pragma mark - Delegate
/*  1.系统的代理方法放在自定义代理方法前面
 2.每一个delegate都把对应的protocol名字带上,
 比如: UITableViewDelegate的方法集就老老实实写上#pragma mark - UITableViewDelegate
 */

#pragma mark - event response
/* 所有button、gestureRecognizer的响应事件都放在这个区域里面 */

#pragma mark - private methods
/* 关于private methods，正常情况下ViewController里面不应该写,
 要么把它写成一个category，要么把他做成一个模块，哪怕这个模块只有一个函数也行。
 */

#pragma mark - getters and setters


@end
